package com.qingcloud.api.dcengine.enums;

/**
 * 数据异常类型
 */
public enum DataExceptionTypeEnum {

    NOT_ENOUGH(1, "样本量不足"),
    LOWER(2, "超下限"),
    UPPER(3, "超上限"),
    DISCRETE(4, "离群值"),
    PM_WRONG(5, "颗粒物倒挂"),
    SENSOR_WRONG(6, "传感器状态异常"),
    DEVICE_REBOOT(7, "设备重新上电"),
    GS_ENV(8, "高湿环境");

    public int code;

    public String name;

    DataExceptionTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据编码获取名称
     */
    public static String getNameByCode(int code) {
        for (DataExceptionTypeEnum cpt : DataExceptionTypeEnum.values()) {
            if (code == cpt.code) {
                return cpt.name;
            }
        }
        return null;
    }
}
